var readline = require('readline-sync')
readline.setDefaultOptions({prompt: ''})
var readline = readline.prompt
let number = parseInt(readline()) // 输入的钱
number = 1024 - number
let count = 0
while(number >= 64){
  count++
  number -= 64
}
while(number >= 16){
  count++
  number -= 16
}
while(number >= 4){
  count++
  number -= 4
}
while(number >= 1){
  count++
  number -= 1
}
console.log(count)
